package com.jwaoo.chat.session.actions;

import com.jwaoo.chat.ChatConstants;
import com.jwaoo.chat.Message;
import com.jwaoo.chat.R;
import com.jwaoo.chat.attachment.FileAttachment;
import com.jwaoo.chat.data.db.MessageHandler;

import java.io.File;

/**
 * Created by hzxuwen on 2015/6/12.
 */
public class ImageAction extends PickImageAction {

    public ImageAction() {
        super(R.drawable.nim_message_plus_photo_selector, R.string.input_panel_photo, true);
    }

    @Override
    protected void onPicked(File file) {
        FileAttachment fileAttachment = new FileAttachment();
        fileAttachment.setPath(file.getAbsolutePath());
        Message message = MessageHandler.getInstace(getContainer().activity.getApplicationContext()).createMessage(ChatConstants.image,getContainer().account,fileAttachment);
        sendMessage(message);
    }
}

